/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extension.maubinh.handler;

import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;
import extension.room.maubinh.MauBinhExtension;
import extension.room.maubinh.MauBinhGame;

/**
 *
 * @author daz
 */
public class StartGameHandler extends BaseClientRequestHandler {

    @Override
    public void handleClientRequest(User user, ISFSObject isfso) {
        MauBinhExtension ext = (MauBinhExtension) getParentExtension();
        MauBinhGame game = ext.getGame();
        if (game.getNumberPlayings() >= 2 && !game.isIsDealed() && game.getGameState() == MauBinhGame.READY_COUNT) {
            game.setGameState(MauBinhGame.SORT_CARD);
        }

    }
}
